<%
    var len = it.item.length;

    var statue = "";

%>
<% if(len !=0){%>
<thead>
<tr>
    <!--<th><input class="tableSelectCheckBox parentCheckBox" type="checkbox"/></th>-->
    <th>#</th>
    <th style="width:80px;">上报id</th>
    <th style="width:80px;">appkey</th>
    <th >名称</th>
    <th>申请人</th>
    <th style="width:120px;">申请时间</th>
   <!-- <th >业务描述</th>-->
    <th >详情</th>
    <th style="width:120px;"><%= it.role ==1 ? '操作' : '状态'%></th>
    <%if (it.role != 1) { %>
    <th style="width:120px;">操作</th>
    <% }%>


</tr>
</thead>

<tbody id="applyList">
<%
var one ;
for(var i = 0; i<len ; i++){
    one = it.item[i];
    one.status -= 0;
    var STATUS_BLOCK_HEIGHT = 24;
    var status = 'applying-active';
    var statusText = '待审核';
    var statusClass = 'applyingBtn'
    var blacklistIPStr = '';
    var blacklistUAStr = '';

    try {
        one.blacklist = JSON.parse(one.blacklist || {})
    }catch(e){
        one.blacklist = {};
    }
    blacklistIPStr =  one.blacklist.ip ? one.blacklist.ip.join(',') : ''
    blacklistUAStr =  one.blacklist.ua ? one.blacklist.ua.join(',') : ''

    if(one.status != 0){
        status = one.status ==1 ? 'agree-active' : 'disagree-active';
        statusText = one.status ==1 ? '已通过' : '已拒绝';
        statusClass = one.status ==1 ? 'passBtn' : 'rejectedBtn';
    }

%>
    <tr class="listRow" >
        <!--<td><input class="tableSelectCheckBox" type="checkbox"/></td>-->
        <td class=""><%=(i +1)%></td>
        <td class="apply_id" style="text-align: center;"><%=one.id%></td>
        <td class="apply_appkey" style="text-align: center;" >
            <a class="appkey_btn" href="javascript:void(0)" >appkey</a>
            <div class="appkey-panel" style="text-align: left">
                <div> appkey : <strong><%=one.appkey%></strong></div>
            </div>
        </td>
        <td class="apply_name">
            <span style="width:100px;" class="textOverflow" title="<%=one.name%>"><%=one.name%></span>
        </td>
        <td class="apply_userName"><%=one.userName%></td>
        <td class="apply_createTime"><%= _.formatDate( new Date(one.createTime) , 'YYYY-MM-DD' )%></td>
       <!-- <td  class="apply_description">
            <span style="width:250px;" class="textOverflow" title="<%=one.description%>"> <%=one.description%></span>
        </td>-->
        <td class="apply_url" >
            <span style="width:270px;" class="textOverflow" title="<%=one.url%>"><b>url：</b><%=one.url%></span>
            <span style="width:270px;" class="textOverflow" >
                <b>ip：</b><%= blacklistIPStr    %>
            </span>
             <span style="width:270px;" class="textOverflow" >
                <b>userAgent：</b><%= blacklistUAStr    %>
              </span>
            <span style="width:270px;" class="textOverflow" title="<%=one.description%>"><b>描述：</b><%=one.description%></span>
        </td>

        <td class="apply_operation">
            <%if(it.role == 1){%>
            <div  class="modifyBtn approveBtn <%=statusClass%>">
                <%= statusText%>
            </div>
            <div class="approveBlock" >
                <div class="closeBtn">关闭</div>
                <input  class="rowBlock replyText" type="text" name="description" placeholder="操作描述"/>
                <div id="statusPanel" class="<%= status%>" data-value="<%= one.status%>">
                    <div class="statusBtn applying" data-type="applying" data-value="0">待审核</div>
                    <div class="statusBtn agree" data-type="agree" data-value="1">通过</div>
                    <div class="statusBtn disagree" data-type="disagree" data-value="2">拒绝</div>
                    <div class="statusBtn delete" data-type="delete" >删除</div>
                </div>
                <div class="operation" data-apply_id="<%=one.id%>">
                    <button class="submitBtn" >确定</button>
                </div>
            </div>
            <%} else {%>
            <div  class=" <%=statusClass%>">
                <%= statusText%>
            </div>
            <%}%>
        </td>
        <%if (it.role != 1) { %>
        <td>
            <%  if(true || one.status != 1) {%>
            <button class="editBtn">
                <a href="apply.html?applyId=<%=one.id%>">编辑</a>
            </button>
            <% } %>
            <button class="deleteBtn" data-applyid="<%=one.id%>">
                <a href="javascript:void(0)">删除</a>
            </button>
        </td>
        <%}%>
    </tr>
<%}%>
</tbody>
<%}%>
